#include "filedialog.h"
#include <QFileDialog>

FileDialog::FileDialog(QWidget *parent)
    : QDialog(parent)
{
    fileBtn = new QPushButton(tr("File"));
    fileLineEdit = new QLineEdit();
    mainLayout = new QGridLayout(this); //do not forget 'this'

    mainLayout->addWidget(fileBtn, 0, 0, 1, 1);
    mainLayout->addWidget(fileLineEdit, 0, 1, 1, 5);

    connect(fileBtn, SIGNAL(clicked(bool)), this, SLOT(showFile()));
}

FileDialog::~FileDialog()
{

}

void FileDialog::showFile()
{
    QString str = QFileDialog::getOpenFileName(this, tr("Open file"), "/",
                                               "C++ files(*.cpp)::C files(*.c)::Head files(*.h)");
    fileLineEdit->setText(str);
}
